//
//  AddSexPickerView.m
//  MIDI
//
//  Created by 邵子凡 on 15/11/24.
//  Copyright © 2015年 QXSX. All rights reserved.
//

#import "AddSexPickerView.h"
#import "AppConfig.h"
#import "AddCoverView.h"

@interface AddSexPickerView()

@property (strong, nonatomic) UIButton *boyBtn;
@property (strong, nonatomic) UIButton *girlBtn;

@end

@implementation AddSexPickerView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self == [super initWithFrame:frame]){
        
        [self setFrame:CGRectMake(0, kWindowHeight, kWindowWidth, kWindowHeight)];
        self.backgroundColor = [UIColor blackColor];
        self.alpha = 0.5;
        
        UIView *view = [[UIView alloc] initWithFrame:
                            CGRectMake(0, kWindowHeight - 150, kWindowWidth, 150)];
        
        [self addSubview:view];
        
        UIButton *boyBtn = [[UIButton alloc]init];
        boyBtn.tag = 1;
        boyBtn.frame = CGRectMake(0, 0, kWindowWidth, 50);
        [boyBtn setTitle:@"男" forState:UIControlStateNormal];
        [boyBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        boyBtn.backgroundColor = [UIColor whiteColor];
        [boyBtn addTarget:self action:@selector(sexBtn_Click:) forControlEvents:UIControlEventTouchUpInside];
        self.boyBtn = boyBtn;
        [view addSubview:boyBtn];
        
        UIButton *girlBtn = [[UIButton alloc]init];
        girlBtn.tag = 2;
        girlBtn.frame = CGRectMake(0, 50, kWindowWidth, 50);
        [girlBtn setTitle:@"女" forState:UIControlStateNormal];
        [girlBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        girlBtn.backgroundColor = [UIColor whiteColor];
        
        //分割线
        UIView *line = [[UIView alloc]init];
        line.frame = CGRectMake(0, 0, kWindowWidth, 1);
        line.backgroundColor = UIColorRGBA(233, 233, 233, 1);
        [girlBtn addSubview:line];
        
        self.girlBtn = girlBtn;
        [girlBtn addTarget:self action:@selector(sexBtn_Click:) forControlEvents:UIControlEventTouchUpInside];
        [view addSubview:girlBtn];
        
        UIButton *cancelBtn = [[UIButton alloc]init];
        cancelBtn.frame = CGRectMake(0, 100, kWindowWidth, 50);
        [cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
        [cancelBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        cancelBtn.backgroundColor = UIColorRGBA(19, 208, 202, 1);
        [cancelBtn addTarget:self action:@selector(cancelBtn_Click) forControlEvents:UIControlEventTouchUpInside];
        [view addSubview:cancelBtn];
        
    }
    return self;
}

- (void)cancelBtn_Click{
    
    [self removeFromSuperview];
    
    
}

- (void)sexBtn_Click:(UIButton *)sender{
    
    if ([self.delegate respondsToSelector:@selector(uploadSexLabel:)]) {
        
        [self.delegate uploadSexLabel:sender];
    }
    
    [self removeFromSuperview];
}

@end









